﻿using System.Collections.Generic;

namespace LxCFD
{
    public class TurbulenceGroup : SolvableUnitGroup<RANSkwUnit>, ITurbulentSolvable
    {
        public List<TurbulenceModelkw> kwZoneTempStore = new List<TurbulenceModelkw>();
        public List<ConnectWallBase> kwContactTempStore = new List<ConnectWallBase>();//暂时不用，占位

        public override void Rearrange(ConnectivityAnalysis connectivityAnalysis)
        {
            Units = new List<RANSkwUnit>();
            var list = connectivityAnalysis.SplitByConnectivity(kwZoneTempStore, kwContactTempStore);
            foreach (var l in list)
            {
                RANSkwUnit u = new RANSkwUnit();
                u.Initialize(l.Zones, l.Contacts);
                u.SolverType = this.SolverType;
                Units.Add(u);
            }
            kwZoneTempStore.Clear();
            kwContactTempStore.Clear();
        }
        public void UpdateGammaForMomentum(int taskIndex)
        {
            foreach (var u in Units)
            {
                u.UpdateGammaForMomentum(taskIndex);
            }
        }

        public void UpdateGammaForTemperature(int taskIndex)
        {
            foreach (var u in Units)
            {
                u.UpdateGammaForTemperature(taskIndex);
            }
        }


    }
}
//public void Addkew(TurbulenceModelkw kew)
//{
//    kws.Add(kew);
//    ks.Add(kew.k);
//    ws.Add(kew.w);
//}
//public RANSkwUnit kwStor { get; set; }
//public override void Clear()
//{
//    base.Clear();
//    kwStor = new RANSkwUnit();
//}